<?php
/**
 * Created by PhpStorm.
 * User: shx
 * Date: 2016/11/25
 * Time: 14:49
 */

namespace App\Http\Controllers\Api;

use App\Model\Users;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class UserController extends Controller
{
    private $user = null;

    public function isBindWx()
    {
        $this->initUser();

        if (!$this->user) return '0';

        return $this->user->isBindWx() ? '1' : '0';
    }

    public function isSubscribeWx()
    {
        $this->initUser();

        if (!$this->user) return '0';

        return $this->user->isSubscribeWx() ? '1' : '0';
    }

    private function initUser()
    {
        if (session('user')) $this->user = Users::find(session('user')->id);
    }

}